import './index.scss'

export interface AProps {
  className?: string;
  style?: any;
  children?: any;
  title?: string;
  para?: any;
  disabled?: boolean;
  onClick?: (para?: any, e?: any) => void;
}

const A = (props: AProps) => {

  const disabled = props.disabled;
  if (disabled) {
    const className = "disabled" + (props.className ? " " + props.className : "");
    return (
      <span className={className} style={props.style}>
        {props.children}
      </span>
    );
  }

  const extraProps = {...props};
  delete extraProps.onClick;
  delete extraProps.children;

  const onClick = (e: any) => {
    e.preventDefault();
    if (props.onClick) {
      props.onClick(props.para, e);
    }
  };

  return (
    <a href="#" {...extraProps} onClick={onClick}>
      {props.children}
    </a>
  );
};

export default A
// export default withPermission(A);
